/*************************************************************************
	> File Name: command.h
	> Author: ma6174
	> Mail: ma6174@163.com 
	> Created Time: 2021年12月08日 星期三 21时27分28秒
 ************************************************************************/

#include<iostream>
#include <string>

struct Barbecuer
{
	void bakeMutton()
	{
		std::cout << "烤羊肉串!" << std::endl;
	}

	void bakeChickenWing()
	{
		std::cout << "烤鸡翅!" << std::endl;
	}
};

//命令类
class Command
{
public:
	Command() = default;
	Command(Barbecuer re) : receiver(re) {}

	virtual void executeCommand() = 0;

protected:
	Barbecuer receiver;
};

class BakeMuttonCommand : public Command
{
public:
	using Command::Command;

	virtual void executeCommand()
	{
		receiver.bakeMutton();
	}
};

class BakeChickenWingCommand : public Command
{
	using Command::Command;

	virtual void executeCommand()
	{
		receiver.bakeChickenWing();
	}
};

//服务员类
class Waiter
{
public:
	~Waiter()
	{
		delete command;
	}
	void setOrder(Command* cmd)
	{
		this->command = cmd;
	}

	void notify()
	{
		command->executeCommand();
	}

private:
	Command* command;
};
